﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Growatt.OutPutDataProcess
{
    //var_addr = a_addr + m_num* a_size + b_addr + n_num* b_size # a_addr为变量a的起始地址 # m_num为a[m]中的m # a_size为类型a的大小 # b_addr为b成员在结构体a中的偏移量 # n_num为b[n]中的n # b_size为类型b的大小

    public class BaseModel
    {
        public string DW_AT_name { get; set; }
        public string line { get; set; }
        public string DW_AT_TI_symbol_name { get; set; }
    }
    public class DW_TAG_base_type : BaseModel
    {
        public string DW_AT_byte_size { get; set; }
    }

    public class DW_TAG_pointer_type : BaseModel
    {
        public string DW_AT_type { get; set; }

    }

    /// <summary>
    /// var_addr = a_addr + m_num* a_size + DW_AT_data_member_location + n_num* b_size
    /// </summary>
    public class DW_TAG_enumerator : BaseModel
    {
        public string DW_AT_type { get; set; }

        /// <summary>
        /// 偏移
        /// </summary>
        public string DW_AT_const_value { get; set; }
    }

    /// <summary>
    /// var_addr = a_addr + m_num* a_size + DW_AT_data_member_location + n_num* b_size
    /// </summary>
    public class DW_TAG_member : BaseModel
    {
        public string DW_AT_type { get; set; }
        /// <summary>
        /// 大小
        /// </summary>
        public string DW_AT_bit_size { get; set; }
        /// <summary>
        /// 偏移
        /// </summary>
        public string DW_AT_data_member_location { get; set; }
    }
    /// <summary>
    /// 查找类型
    /// </summary>
    public class DW_TAG_typedef : BaseModel
    {
        public string DW_AT_type { get; set; }
    }
    public class DW_TAG_array_type : BaseModel
    {
        public string DW_AT_type { get; set; }
        public string DW_AT_byte_size { get; set; }
    }

    /// <summary>
    /// 变量信息
    /// </summary>
    public class DW_TAG_variable : BaseModel
    {
        public string DW_AT_type { get; set; }
    }

    public class DW_TAG_structure_type : BaseModel
    {
        public List<DW_TAG_member> List_DW_TAG_member { get; set; } = new List<DW_TAG_member>();
        public string DW_AT_byte_size { get; set; }
    }


    public class DW_TAG_union_type : BaseModel
    {
        public List<DW_TAG_member> List_DW_TAG_member { get; set; } = new List<DW_TAG_member>();
        public string DW_AT_byte_size { get; set; }
    }

    public class DW_TAG_enumeration_type : BaseModel
    {
        public List<DW_TAG_enumerator> ListDW_TAG_enumerator { get; set; } = new List<DW_TAG_enumerator>();
        public string DW_AT_byte_size { get; set; }
    }
}
